package org.springblade.modules.notice.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.*;

/**
 * @Author ysq
 * @Date 2025/08/14
 * @Description APP推送铃声枚举
 */
@Getter
@AllArgsConstructor
public enum AppPushSoundEnum {

	SOUND_1("rescue_not_dispatched_on_time", "困人救援未及时出发，请及时前往", new Integer[] { BusinessType.RESCUE.getCode() }),

	SOUND_2("rescue_overdue_not_arrived", "困人救援超时未达，请及时前往", new Integer[] { BusinessType.RESCUE.getCode() }),

	SOUND_3("rescue_overdue_arrived ", "困人救援超时到达，请加快救援进展，及时安抚被困人", new Integer[] { BusinessType.RESCUE.getCode() }),

	SOUND_4("rescue_5min_before_overdue_arrival ", "困人救援预计五分钟后将超时到达，请立即前往现场", new Integer[] { BusinessType.RESCUE.getCode()})
	;

	private final String code;

	private final String desc;

	/**
	 * 作用范围，对应code集合
	 * @see BusinessType
	 */
	private final Integer[] scopes;

	/**
	 * 获取可选列表
	 * @param businessType 业务类型
	 */
	public static List<Map<String, String>> getSelectList(Integer businessType) {
		List<Map<String, String>> list = new ArrayList<>(16);
		for (AppPushSoundEnum value : values()) {
			if (businessType != null) {
				if (!Arrays.asList(value.getScopes()).contains(businessType)) {
					continue;
				}
			}
			Map<String, String> map = new HashMap<>(2);
			map.put("code", value.getCode());
			map.put("desc", value.getDesc());
			list.add(map);
		}
		return list;
	}

}
